package ThreadDemo;

public class threadDemo3 {
    public static void main(String[] args) {
      //第一种：继承Thread重写run方法
        Thread t1= new MyThread1();


        /*
        Runnable  r2=new MyThread2();

         */

       /* Runnable r2=()->{
            for (int i = 0; i < 1000; i++) {
                System.out.printf("矮油，你干嘛");
            }
        };
        Thread t2=new Thread(r2);

        */
        Thread t2= new Thread(()->{
            for (int i = 0; i < 1000; i++) {
                System.out.printf("哎呦，你干嘛，食不食香煎鱿鱼");
            }
        });

        t1.start();
        t2.start();
    }

}
class MyThread1 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("哎呦你干嘛");
        }
    }
}
/*
class  MyThread2 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("大家好，我是练习时常2年半的练习生");
        }
    }



}
*/

